package cn.zcscloud.mall.controller;

import cn.zcscloud.mall.common.R;
import cn.zcscloud.mall.mbg.model.UmsMemberLevel;
import cn.zcscloud.mall.service.UmsMemberLevelService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/memberLevel")
public class UmsMemberLevelController {
    @Autowired
    private UmsMemberLevelService memberLevelService;

    @GetMapping("/list")
    public R list(@RequestParam("defaultStatus") Integer defaultStatus){
        LambdaQueryWrapper<UmsMemberLevel>  queryWrapper = new LambdaQueryWrapper<UmsMemberLevel>();
        queryWrapper.eq(defaultStatus != null,UmsMemberLevel::getDefaultStatus,defaultStatus);
        List<UmsMemberLevel> list = memberLevelService.list(queryWrapper);
        return R.success(list);
    }
}
